//
//  MovieList9View.m
//  UI-豆瓣项目APP
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 孙鹏. All rights reserved.
//

#import "MovieList9View.h"

@implementation MovieList9View

-(instancetype)initWithFrame:(CGRect)frame
{
    
    
    self = [super initWithFrame:frame];
    if (self) {
        
        
        [self creatSubviews];
    }
    return self;
    
}


-(void)creatSubviews
{
    
    self.headImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 150)];
    [self addSubview:self.headImage];

    self.headImage.userInteractionEnabled = YES;
    [self.headImage release];
    
    
    self.movieName = [[UILabel alloc]initWithFrame:CGRectMake(0, 150, 100, 20)];
    [self addSubview:self.movieName];
    self.movieName.textAlignment = NSTextAlignmentCenter;
    self.movieName.lineBreakMode = NSLineBreakByTruncatingMiddle;

    [self.movieName release];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];
    [self.headImage addGestureRecognizer:tap];
    [tap release];
    
    
    
}
- (void)tapAction:(UITapGestureRecognizer *)tap
{
    
    NSInteger index =  tap.view.tag - 1000;
    NSLog(@"=====%ld",index);
    [self.delegete tagToMovieListController:index];
    
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
